import React, {Component} from 'react';
import axios from "axios";
import withHoc from "./hoc";

class App extends Component {
    state = {
        items:[],
        isLoading:true
    }
    render() {
        return (
            <div>
                {
                    this.state.items.map(item=>(
                        <p key={item.id}>{item.full_name}</p>
                    ))
                }
            </div>
        );
    }
    async searchRepositories(){
        const {data:{items}} = await axios.get("http://zhangpeiyue.com:8080/index.json")
        this.setState({
            items,
            isLoading:false
        })
    }
    componentDidMount() {
        this.searchRepositories();
    }
}

export default withHoc(App);